<?php if(!defined('BASEPATH')) exit('No script direct allowed access');

class Member_model extends CI_Model
{
	private $table = '';
	
	public function __construct()
	{
		parent::__construct();
		
		$this->table = 'member';
	}
	
	public function add($data)
	{
		if($this->db->insert($this->table, $data)) return TRUE; else return FALSE;
	}
	
	public function checkUser($user)
	{
		$sql = $this->db->select('username')->get_where($this->table, array('username' => $user));
		
		if($sql->num_rows() > 0 )
		{
			return TRUE;
		} else {
		 	return FALSE;
		}
	}
	
	public function checkEmail($email)
	{
		$sql = $this->db->select('email')->get_where($this->table, array('email' => $email));
		
		if($sql->num_rows() > 0 )
		{
			return TRUE;
		} else {
		 	return FALSE;
		}
	}
}
